home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
8174
/
8174.xpi
/
chrome
/
antbar.jar
/
content
/
watchURL.js
< prev
Wrap
Text File
|
2009-12-30
|
2KB
|
93 lines
/*
* DO NOT EDIT THIS FILE !
*
* IT WAS AUTOMATICALLY COPIED FROM THE /lib/ DIRECTORY
* TO UPDATE IT YOU NEED TO BUILD THE XPI OF THE CURRENT PROJECT
*
*/
//
// watchURL.js
// firefox
//
// Created by Zak on 2008-07-14.
// Copyright 2008-2009 Ant.com. All rights reserved.
//
var AntUrlListener =
{
QueryInterface: function(aIID)
{
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},
onLocationChange: function(aProgress, aRequest, aURI)
{
AntWatchUrl.notify(aURI);
},
onStateChange: function() {},
onProgressChange: function() {},
onStatusChange: function() {},
onSecurityChange: function() {},
onLinkIconAvailable: function() {}
};
var AntWatchUrl =
{
watchers: new AntArray(),
inited: false,
init: function ()
{
var self = AntWatchUrl;
if (self.inited)
return;
window.addEventListener("load", function() { AntWatchUrl.start() }, false);
window.addEventListener("unload", function() { AntWatchUrl.stop() }, false);
self.inited = true;
},
start: function ()
{
gBrowser.addProgressListener(AntUrlListener, Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
},
stop: function ()
{
gBrowser.removeProgressListener(AntUrlListener);
},
addWatcher: function (watcher)
{
var self = AntWatchUrl;
self.watchers.push(watcher);
},
removeWatcher: function (watcher)
{
var self = AntWatchUrl;
self.watchers.removeValue(watcher);
},
notify: function (aURI)
{
var self = AntWatchUrl;
if (aURI == null)
aURI = {spec: "about:blank"};
self.watchers.each(
function (handler)
{
handler(aURI);
});
}
};